﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true"
    CodeBehind="Calendar.aspx.cs" Inherits="MVCClubSite.Web.Views.Events.Calendar" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <div class="contentblock">
        <table style="width: 100%; text-align: center;">
            <tr>
                <td style="width: 20%">
                    <%= Html.ActionLink(ViewData.Model.PreviousVisibleDate.ToString("<<< MMMM yyyy"), "Calendar", "Events", new { month = ViewData.Model.PreviousVisibleDate.Month, year = ViewData.Model.PreviousVisibleDate.Year }, null)%>
                </td>
                <td style="width: 60%; text-align: center;">
                    <h1>
                        <%= ViewData.Model.VisibleDate.ToString("MMMM yyyy") %></h1>
                </td>
                <td style="width: 20%; text-align: center;">
                    <%= Html.ActionLink(ViewData.Model.NextVisibleDate.ToString("MMMM yyyy >>>"), "Calendar", "Events", new { month = ViewData.Model.NextVisibleDate.Month, year = ViewData.Model.NextVisibleDate.Year }, null) %>
                </td>
            </tr>
        </table>
                <table class="calendar">
            <tr>
                <th>
                    Sunday
                </th>
                <th>
                    Monday
                </th>
                <th>
                    Tuesday
                </th>
                <th>
                    Wednesday
                </th>
                <th>
                    Thursday
                </th>
                <th>
                    Friday
                </th>
                <th>
                    Saturday
                </th>
            </tr>
            <%  int currentDay = 0;
                for (int i = 0; i <= 5; i++)
                {
                    Response.Write("<tr>");
                    for (int j = 0; j <= 6; j++)
                    {
                        Response.Write("<td class='" + ViewData.Model.Days[currentDay].Style + "'>");
                        Response.Write("<div class='daynumber'>" + ViewData.Model.Days[currentDay].DayNumber + "</div>");
                        Response.Write("<div class='innerday'>");
                        foreach (Event e in ViewData.Model.Days[currentDay].Events)
                        {
                            Response.Write(Html.ActionLink(e.Title, "Details", "Events", new { id = e.ID }, null) + "<br />");
                        }
                        Response.Write("</div>");
                        Response.Write("</td>");
                        currentDay++;
                    }
                    Response.Write("</tr>");
                } %>
        </table>
        <table style="width: 100%; text-align: center;">
            <tr>
                <td style="width: 20%">
                    <%= Html.ActionLink(ViewData.Model.PreviousVisibleDate.ToString("<<< MMMM yyyy"), "Calendar", "Events", new { month = ViewData.Model.PreviousVisibleDate.Month, year = ViewData.Model.PreviousVisibleDate.Year }, null)%>
                </td>
                <td style="width: 60%; text-align: center;">
                </td>
                <td style="width: 20%; text-align: center;">
                    <%= Html.ActionLink(ViewData.Model.NextVisibleDate.ToString("MMMM yyyy >>>"), "Calendar", "Events", new { month = ViewData.Model.NextVisibleDate.Month, year = ViewData.Model.NextVisibleDate.Year }, null) %>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
